/******************************************************
Cours: GTI310
Session: A2014
Groupe: 01
Projet: Laboratoire #3
etudiant(e)s: Fredy Alexander Bonilla et Émile Robinson
              
Professeur : Jean-François Franche
Nom du fichier: Application.java
Date cree: 2014-11-01
Date dern. modif. 2014-11-13
*******************************************************
Historique des modifications
*******************************************************
2014-10-14 Version 1.0
*******************************************************/


package gti310.tp3;

import gti310.tp3.parser.*;
import gti310.tp3.solver.*;
import gti310.tp3.writer.*;

/**
 * The Application class defines a template method to call the elements to
 * solve the problem Unreal-Networks is fa�ing.
 * 
 * @author Fran�ois Caron <francois.caron.7@ens.etsmtl.ca>
 */
public class Application {

	/**
	 * The Application's entry point.
	 * 
	 * The main method makes a series of calls to find a solution to the
	 * problem. The program awaits two arguments, the complete path to the
	 * input file, and the complete path to the output file.
	 * 
	 * @param args The array containing the arguments to the files.
	 */
	public static void main(String args[]) {
		new Application(args);
	}
	
	/**
	 * Exécution du programme
	 * @param args
	 */
	public Application(String args[]){
		
		E extractedFile = null;
		T solvedFile = null;
		
		System.out.println("Unreal Networks Solver !");
		
		//Lecture, validation et enregistrement des données
		Parser<E> parser = new ConcreteParser();
		extractedFile = parser.parse(args[0]);
		
		//Obtention de la solution
		Solver<E,T> solver = new ConcreteSolver();
		solvedFile = solver.solve(extractedFile);

		
		//Écriture de la solution dans un fichier
		Writer<T> writer = new ConcreteWriter();
		writer.write(args[1], solvedFile);
		
	}
}
